import axios from "axios";

const instance = axios.create({
  baseURL: "http://localhost:3000",
  //这个指的是接口域名，将来在使用的时候自动在接口前面加上http://localhost:3000
  timeout: 5000, //表示请求超时时间
  headers: {},
});

// 封装get请求  axios.get(url,{params:params})
export const get = (url, params) => instance.get(url, { params });
// 封装post请求  axios.post(url,{name:'张三'，age:20})
export const post = (url, data) => instance.post(url, data);
// 封装删除接口
export const dele = (url, params) => instance.delete(url, { params });
//封装修改接口
export const put = (url, params) => instance.put(url, { params });
